$(document).ready(function() {
	$('.close_a').click(function() {
		$('.ancitc').fadeOut(function() {
			$('').hide();
		});
		return false;
	});

	$('.zxbj').click(function() {
		var h = $(document).height();
		$('.ancitc').center();
		$('.ancitc').fadeIn();
		return false;
	});

});

$(document).ready(function() {
	$('#close_b').click(function() {
		$('#Design').fadeOut(function() {
			$('').hide();
		});
		return false;
	});

	$('.yysj').click(function() {
		var h = $(document).height();
		$('#Design').center();
		$('#Design').fadeIn();
		return false;
	});

});

$(document).ready(function() {
	$('#close_c').click(function() {
		$('#Quantity').fadeOut(function() {
			$('').hide();
		});
		return false;
	});

	$('.smlf').click(function() {
		var h = $(document).height();
		$('#Quantity').center();
		$('#Quantity').fadeIn();
		return false;
	});

});

$(document).ready(function() {
	$('#close_d').click(function() {
		$('#visit').fadeOut(function() {
			$('').hide();
		});
		return false;
	});

	$('.cggd').click(function() {
		var h = $(document).height();
		$('#visit').center();
		$('#visit').fadeIn();
		return false;
	});

});

jQuery.fn.center = function(loaded) {
	var obj = this;
	body_width = parseInt($(window).width());
	body_height = parseInt($(window).height());
	block_width = parseInt(obj.width());
	block_height = parseInt(obj.height());

	left_position = parseInt((body_width / 2) - (block_width / 2) + $(window).scrollLeft());
	if(body_width < block_width) {
		left_position = 0 + $(window).scrollLeft();
	};

	top_position = parseInt((body_height / 2) - (block_height / 2) + $(window).scrollTop());
	if(body_height < block_height) {
		top_position = 0 + $(window).scrollTop();
	};

	if(!loaded) {

		obj.css({
			'position': 'fixed'
		});
		obj.css({
			'top': top_position,
			'left': left_position
		}, 0, 'linear', 0, 'linear');
		$(window).bind('resize', function() {
			obj.top(!loaded);
		});
		$(window).bind('scroll', function() {
			obj.top(!loaded);
		});

	} else {
		obj.stop();
		obj.css({
			'position': 'fixed'
		});
		obj.animate({
			'top': top_position
		}, 0, 'linear');
	}
}

$(function() {

	jQuery(".index-banner").slide({
		mainCell: ".bd ul",
		effect: "left",
		autoPlay: true
	});

	jQuery(".index-baojia-zixun").slide({
		titCell: ".hd ul",
		mainCell: ".bd ul",
		autoPage: true,
		vis: 1,
		effect: "top",
		autoPlay: true
	});
	jQuery(".index-baojia-pic").slide({
		mainCell: ".bd ul",
		effect: "fold",
		autoPlay: true
	});

	//实景图	
	jQuery(".index-realpic").slide({
		effect: "fold"
	});

	//设计师	
	jQuery(".index-designer-main").slide({
		effect: "fold"
	});

	//vr
	jQuery(".index-vr").slide({
		effect: "fold"
	});

	//实力图片滚动
	jQuery(".index-strength-pic").slide({
		mainCell: ".bd ul",
		effect: "fold",
		autoPlay: true
	});

	//地区切换
	$(".fwdz strong").click(function() {
		$(".fwdz .map").toggle();
	})

	//erweima
	$("header .toper .hyld strong a.a3").click(function() {
		$(".erweima").toggle();
	})

	$('.navbar-nav li').click(function() {
		$(this).find('.dropdown-menu').stop().slideToggle();
		$(this).toggleClass('on')

	})
	$('.ad-input').click(function() {
		$('.ad-ul').stop().slideToggle();
	})
	$('.ad-ul li').click(function() {
		var var1 = $(this).html();
		$('.ad-input1').val(var1);
		$('.ad-ul').slideUp()

	})

	jQuery(".normal-sec1 .right").slide({
		titCell: ".hd ul",
		mainCell: ".bd ul",
		autoPage: true,
		effect: "top",
		autoPlay: true
	});
	jQuery(".normal-sec2 .tab-cont").slide({
		titCell: ".tab-hd li",
		mainCell: ".tab-bd"
	});

	//实力图片滚动
	jQuery(".normal-sec4 .gun ").slide({
		titCell: ".hd li",
		mainCell: ".bd ul",
		effect: "fold",
		autoPlay: true,
		delayTime: 700
	});

	/* 内层图片滚动 */
	jQuery(".slideBox2").slide({
		mainCell: ".bd ul",
		prevCell: ".sprev",
		nextCell: ".snext",
		effect: "fold",
		interTime: 50,
		trigger: "click"
	});
	/* 外层tab切换 */
	jQuery(".slideGroup2").slide({
		titCell: ".parHd ul>li",
		mainCell: ".parBd"
	});
	/* 外层tab切换 */
	jQuery(".gaoduan-sec3 .w1260").slide({
		titCell: ".tab-hd li",
		mainCell: ".tab-bd"
	});

	var swiper = new Swiper('.nor-sec7', {
		scrollbar: '.swiper-scrollbar',
		scrollbarHide: true,
		slidesPerView: '4',
		centeredSlides: false,
		spaceBetween: 30,
	});

	var swiper = new Swiper('.gaoduan-swiper', {
		pagination: '.pagination',
		paginationClickable: true,
		centeredSlides: true,
		slidesPerView: 3,
		watchActiveIndex: true,
		loop: true,
	});

	/* 外层tab切换 */
	jQuery(".service .w1260").slide({
		titCell: ".tab-hd li",
		mainCell: ".tab-bd"
	});
	jQuery(".gaoduan-sec5 .w1260").slide({
		titCell: ".tab-hd li",
		mainCell: ".tab-bd"
	});
	jQuery(".gaoduan-sec6 .cont").slide({
		titCell: ".tab-hd li",
		mainCell: ".tab-bd"
	});
	jQuery(".feedback-cont .right").slide({
		titCell: ".hd li",
		mainCell: ".bd ul",
		effect: "fold",
		autoPlay: true,
		delayTime: 700
	});
	jQuery(".gaoduan-sec8").slide({
		titCell: ".hd ul",
		mainCell: ".bd ul",
		autoPage: true,
		effect: "left",
		autoPlay: true,
		vis: 3,
		pnLoop: true
	});
	jQuery(".pz-sec2").slide({
		titCell: ".hd li",
		mainCell: ".bd"
	});

	jQuery(".pz-sec5").slide({
		titCell: ".hd li",
		mainCell: ".bd"
	});
	jQuery(".pz-sec7").slide({
		titCell: ".hd ul",
		mainCell: ".bd ul",
		autoPage: true,
		effect: "left",
		autoPlay: true,
		vis: 4,
		pnLoop: true
	});
})

$(function() {
	var swiper = new Swiper('.brand-sec2 .swiper-container', {
		slidesPerView: 4,
		spaceBetween: 10,
		centeredSlides: false,
		autoplay: true,
		speed: 2000,
		// init: false,
		pagination: {
			el: '.swiper-pagination',
			clickable: true,
		},
	});
	var swiper = new Swiper('.brand-sec5 .swiper-container', {
		slidesPerView: 7,
		spaceBetween: 10,
		// init: false,

	});
	var flag = true;
	$('.brand-sec3 .brand-btn').click(function() {
		if(flag) {
			$(this).prev('.p1').css('height', 'auto');
			$(this).find('em').html('收起');
			$(this).addClass('on');
			$(this).parent('.left').css('height', 'auto');
			$(this).parent('.right').css('height', 'auto');
		} else {
			$(this).prev('.p1').css('height', '60px');
			$(this).find('em').html('展开全部');
			$(this).removeClass('on');
			$(this).parent('.left').css('height', '240px');
			$(this).parent('.right').css('height', '240px');
		}
		flag = !flag;
	})

	$('.brand-sec3 .div:gt(1)').css('display', "none");

	$('.brand-sec3 .brandmore').click(function() {
		if(flag) {
			$('.brand-sec3 .div:gt(1)').show();
			$(this).find('p').html('加载完毕')
		} else {
			$('.brand-sec3 .div:gt(1)').hide();
			$(this).find('p').html('加载所有')
		}
		flag = !flag;
	})

	jQuery(".brand-sec4 .w1260").slide({
		titCell: ".hd ul",
		mainCell: ".bd ul",
		autoPage: true,
		effect: "left",
		autoPlay: true,
		vis: 3
	});

	jQuery(".bh-left").slide({
		mainCell: ".bd ul",
		autoPlay: true,
		effect: "fade",
		trigger: "click"
	});

	jQuery(".coursepage .left").slide({
		titCell: ".hd li",
		mainCell: ".bd"
	})

	if(/msie (6.0|7.0|8.0|9.0)/i.test(navigator.userAgent)) {
		window.location.href = 'abandoned.html';
	}

	jQuery(".feedback-cont").slide({
		mainCell: ".bd .infoList",
		autoPlay: true,
		effect: "topMarquee",
		vis: 6,
		interTime: 50,
		trigger: "click"
	});

	var swiper = new Swiper('.normal-sec4 .gun', {
		loop:true,
		pagination: '.swiper-pagination',
		paginationClickable: '.swiper-pagination',
		nextButton: '.swiper-button-next',
		prevButton: '.swiper-button-prev',
		effect: 'fade',
		

	});
	



});